<?php

use peng\core\Form;
use peng\helpers\Html;
use common\dao\dd\DataDao;

$rtypeList = DataDao::getSingleton()->getRegisteredUserType();
$utypeList = DataDao::getSingleton()->getRegisteredType();
?>
<div id="mainbody" class="CWL CWR">
    <input type="password" style="display: none" />
    <div id="loginDiv">
        <div id="logininfo">
            <table border="0">
                <tr><td>
                        <div class="">
                            <div id="banner">
                                <div id="banner_bg"></div><!--标题背景-->
                                <div id="banner_info"></div><!--标题-->
                                <ul>
                                    <li class="on">1</li>
                                    <li>2</li>
                                    <li>3</li>
                                    <li>4</li>
                                </ul>
                                <div id="banner_list">
                                    <a href="#" target="_blank"><img src="<?php echo $this->cssPath; ?>web/images/1.jpg" title="广告1" alt="广告1"/></a>
                                    <a href="#" target="_blank"><img src="<?php echo $this->cssPath; ?>web/images/7.jpg" title="广告2" alt="广告2"/></a>
                                    <a href="#" target="_blank"><img src="<?php echo $this->cssPath; ?>web/images/12.jpg" title="广告3" alt="广告3"/></a>
                                    <a href="#" target="_blank"><img src="<?php echo $this->cssPath; ?>web/images/4.jpg" title="广告4" alt="广告4"/></a>
                                </div>
                            </div>

                            <script type="text/javascript">
                                var t = n = 0, count;
                                $(document).ready(function() {
                                    count = $("#banner_list a").length;
                                    $("#banner_list a:not(:first-child)").hide();
                                    $("#banner_info").html($("#banner_list a:first-child").find("img").attr('alt'));
                                    $("#banner_info").click(function() {
                                        window.open($("#banner_list a:first-child").attr('href'), "_blank")
                                    });
                                    $("#banner li").click(function() {
                                        var i = $(this).text() - 1;//获取Li元素内的值，即1，2，3，4
                                        n = i;
                                        if (i >= count)
                                            return;
                                        $("#banner_info").html($("#banner_list a").eq(i).find("img").attr('alt'));
                                        $("#banner_info").unbind().click(function() {
                                            window.open($("#banner_list a").eq(i).attr('href'), "_blank")
                                        })
                                        $("#banner_list a").filter(":visible").fadeOut(500).parent().children().eq(i).fadeIn(1000);
                                        document.getElementById("banner").style.background = "";
                                        $(this).toggleClass("on");
                                        $(this).siblings().removeAttr("class");
                                    });
                                    t = setInterval("showAuto()", 4000);
                                    $("#banner").hover(function() {
                                        clearInterval(t)
                                    }, function() {
                                        t = setInterval("showAuto()", 4000);
                                    });
                                })

                                function showAuto()
                                {
                                    n = n >= (count - 1) ? 0 : ++n;
                                    $("#banner li").eq(n).trigger('click');
                                }
                            </script>
                        </div>
                    </td>
                    <td><div class="kong"></div>
                        <div class="kong"></div>
                        <div id="loginCar1">	
                            <div id="register">
                                <?php $form = Form::begin() ?>
                                <div style="width: 800px; margin: 0 auto; border: 1px solid #333;">
                                    <div id="regEmail" style="position: relative;">
                                        <dl class="reg-item">
                                            <dt class="reg-item-tit">
                                            <span class="req-sign">
                                                *
                                            </span>
                                            注册用户类型
                                            </dt>
                                            <dd class="reg-item-ct">
                                                <?php echo $form->activeRadio($this->model, 'rtype', $utypeList,array('class'=>'radi')); ?><?php echo $this->model->getErrors('utype') ?> 
                                            </dd>
                                        </dl>
                                        <dl class="reg-item">
                                            <dt class="reg-item-tit">
                                            <span class="req-sign">
                                                *
                                            </span>
                                            注册账号类型
                                            </dt>
                                            <dd class="reg-item-ct">
                                                <?php echo $form->activeRadio($this->model, 'utype', $rtypeList,array('class'=>'radi')); ?><?php echo $this->model->getErrors('rtype') ?> 
                                            </dd>
                                        </dl>
                                        <dl class="reg-item">
                                            <dt class="reg-item-tit">
                                            <span class="req-sign">
                                                *
                                            </span>
                                            账号
                                            </dt>
                                            <dd class="reg-item-ct">
                                                <?php echo $form->activeText($this->model, 'loginname', array('class' => 'nor-tt', 'maxlength' => 50, 'autocomplete' => 'off')); ?><?php echo $this->model->getErrors('loginname') ?> 
                                                <div id="emailTips" class="tips">
                                                    6~18个字符，可使用字母、数字、下划线，需以字母开头
                                                </div>
                                            </dd>
                                        </dl>
                                        <dl class="reg-item">
                                            <dt class="reg-item-tit">
                                            <span class="req-sign">
                                                *
                                            </span>
                                            密码
                                            </dt>
                                            <dd class="reg-item-ct">
                                                <?php echo $form->activePassword($this->model, 'password', array('class' => 'nor-tt', 'maxlength' => 50, 'autocomplete' => 'off')); ?><?php echo $this->model->getErrors('password') ?> 
                                                <div id="pwdTips" class="tips">
                                                    6~16个字符，区分大小写
                                                </div>
                                            </dd>
                                        </dl>
                                        <dl class="reg-item">
                                            <dt class="reg-item-tit">
                                            <span class="req-flag">
                                                *
                                            </span>
                                            确认密码
                                            </dt>
                                            <dd class="reg-item-ct">
                                                <?php echo $form->activePassword($this->model, 'cfmpwd', array('class' => 'nor-tt', 'maxlength' => 50, 'autocomplete' => 'off')); ?><?php echo $this->model->getErrors('cfmpwd') ?> 
                                                <div id="cfmPwdTips" class="tips" >
                                                    请再次填写密码
                                                </div>
                                            </dd>
                                        </dl>
                                        <dl class="reg-item">
                                            <dt class="reg-item-tit">
                                            <span class="req-flag">
                                                *
                                            </span>
                                            验证码
                                            </dt>
                                            <dd class="reg-item-ct" >
                                                <div style="float:left;">                                                  
                                                    <?php echo $form->activeText($this->model, 'verifycode', array('class' => 'nor-tt vcode', 'maxlength' => 4, 'autocomplete' => 'off')); ?>       
                                                </div>
                                                <div style="float:left;margin-left:10px">
                                                    <?php echo Html::img('/verifyCode',array('onclick'=>'this.src="/verifyCode?r="+Math.random();','alt'=>'看不清，点击刷新','style'=>'cursor:pointer;')); ?>  
                                                </div>
                                                <div style="clear:both"></div>
                                                <div id="checkCodeTips" class="tips" style="float:left;"> 
                                                        请填写图片中的字符，不区分大小写
                                                </div>
                                                <div style="clear:both"><?php echo $this->model->getErrors('verifycode') ?> </div>
                                            </dd>
                                        </dl>
                                        <dl class="reg-item">
                                            <dd class="reg-item-ct">
                                                <?php echo Html::submitButton('立即注册', array('class' => 'btn-register', 'name' => 'submit-button')) ?> 
                                            </dd>
                                        </dl>
                                    </div>
                                </div>
                                <?php Form::end(); ?>
                            </div>
                            <div class="kong"></div>
                        </div>
                    </td>
                </tr></table>
        </div>		
    </div>	
</div>
<script>
    /*
     $().ready(function() {
     $("#registerForm input[type='text']").bind({focus:function(){$(this).parent().addClass("reg-item-ct-focus");},
     blur:function(){$(this).parent().removeClass("reg-item-ct-focus");}});
     $("#vcodeImg,#vcodeA").bind("click",function(){$("#vcodeImg").attr("src","/site/getcode?"+Math.random());})
     $("#registerForm").validate({
     errorPlacement: function(error, element) {
     
     error.appendTo(element.parent());
     
     },
     highlight: function(element, errorClass) {
     $(element).addClass("ct-err");  
     $("#"+$(element).attr("id")+"Tips").hide();
     
     },
     unhighlight: function(element, errorClass) {
     $(element).removeClass("ct-err");  
     $("#"+$(element).attr("id")+"Tips").show();
     },
     rules: {
     email: {
     required: true,
     email: true
     },
     pwd: {
     required: true,
     minlength: 6
     },
     cfmPwd: {
     required: true,
     equalTo: "#pwd"
     },
     checkCode: "required"
     },
     messages: {
     email: {
     required: "请填写邮件地址",
     email: "请填写正确的邮箱"
     },
     pwd: {
     required: "请填写密码",
     minlength: "密码长度至少为6个字符"
     },
     cfmPwd: {
     required: "请再次填写密码",
     equalTo: "密码与确认密码应一致"
     },
     checkCode: "请填写图片中的验证码"
     }
     });
     });*/
</script>
